<?php
$this->title='明源云客-官网管理-新闻管理';
?>
<script>
$(document).ready(function() {
    $('#grid-table').jqGrid(
        {
            treeGrid: true,
            treedatatype: 'json',
            treeGridModel: 'adjacency',
			ExpandColumn: 'id',
			ExpandColClick: true,
            colNames: [
                '#编号',
                '编码',
                '名称',
                '简要描述',
                '排序',
                '发布状态'
                //'对外显示'
			],
            colModel: [
                { index: 'id',name: 'id', align: 'left', sortable: false, width: 50 },
                { index: 'code',name: 'code', align: 'center', sortable: false, width: 80 },
                { index: 'name',name: 'name', align: 'center', sortable: false, editable: true, width: 80 },
                { index: 'short_desc',name: 'short_desc', align: 'left', sortable: false, editable: true, width: 150 },
                { index: 'sort',name: 'sort', align: 'center', sortable: false, editable: true, width: 80 },
                { index: 'status', name: 'status', width: 50, align: 'center', sortable: false, editable: true, edittype: 'checkbox', formatter:'checkbox', editoptions:{value:'1:0'} },
                //{ index: 'external_display', name: 'external_display', width: 50, align: 'center', sortable: false, editable: true, edittype: 'checkbox', formatter:'checkbox', editoptions:{value:'1:0'} }
        ],
            datatype: 'json',
            height: 'auto',
            autowidth: true,
            viewrecords: false,
            pager: $('#grid-pager'),
            cellEdit: true,
            cellurl: '?r=/official/dir/quick-set',
			afterSubmitCell: function(serverresponse, rowid, cellname, value, iRow, iCol) {
				if(''!=serverresponse.responseText){
					var response = $.parseJSON(serverresponse.responseText); 
					return [false, response.errMsg];
				}else return [true];
			},
            loadComplete: function() {
                $('#search-btn').attr('disabled', false);
            },
            ondblClickRow: function(id) {
                window.location.href = '?r=/official/dir/edit&id=' + id;
            }
        }
    ).navGrid(
        '#grid-pager',
        // options
        {
            search: false,
            addfunc: function() {
                window.location.href = '?r=/official/dir/edit';
            },
            editfunc: function(id) {
                window.location.href = '?r=/official/dir/edit&id=' + id;
            },
            del: false
        },
        // edit
        {
        },
        // add
        {
        },
        // del
        {
            url: '?r=/official/dir/delete'
        }
    );
});
</script>

<div ng-view="" class="ng-scope">
    <div class="section-table mt20">
        <div class="table-header lh30 pb5 clearfix">
            <span class="fl f14">目录列表</span>
        </div>
        <div class="mt10">
            <table  id="grid-table" width="100%" border="0" cellspacing="0" cellpadding="0" style="border:0px #DFDFDF solid"></table>
            <div id="grid-pager"></div>
        </div>
    </div>
</div>